namespace Warehouse

open System.Windows.Data
open Warehouse.Controls

open Wpf.Mvc

module ProductSeach = 
    
    let createContoller repository =
        let view = 
            {
                new StaticView<ProductSearchModel, ProductSearchWindow>() with 
                    member this.SetBindings model = 
                        Binding.FromExpression
                            <@ 
                                this.Control.OK.IsEnabled <- isNotNull model.SelectedProduct
                            @>
            }
        view.OKButton <- view.Control.OK

        StaticViewController<ProductSearchModel>(view)
            .Compose(ProductSearchChildController(repository), ProductSearchPartialView(view.Control.ProductSearch))

